<template>
	<view style="padding: 30rpx;">
		<button @click="callStoreFun(1)" type="primary">setStorag</button>
		<button @click="callStoreFun(2)" type="primary" plain="true">getStorag</button>
		<button @click="callStoreFun(3)" type="primary" plain="true">getStoragInof</button>
		<button @click="callStoreFun(4)" type="warn">REmoveStorag</button>
		<button @click="callStoreFun(5)" type="warn">clearStorag</button>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				name:'LL',
				time1:null
			}
		},
		methods: {
			callStoreFun(parm){
				console.log("callStoreFun==>parm"+parm);
				switch(parm){
					case 1:
					uni.setStorage({
						key:'UserName',
						data:'LL',
						success() {
							console.log("UserName 成功");
						}
					})
					break;
					case 2:
					uni.getStorage({
						key:'UserName',
						//回调接口
						success:function(result) {
							console.log("读取UserName成功"+result.data);
						},
						fail() {
							console.error("读取UserName失败");
						}
					});
					break;
					case 3:
					uni.getStorage({
						success:function(result) {
							console.log("获取所有字段值"+result.keys);
						}
					});
					break;
					uni.removeStorage({
						
					});
					
				}
			}
		}
	}
</script>

<style>

</style>
